/*
 * @lc app=leetcode.cn id=392 lang=csharp
 *
 * [392] 判断子序列
 */

// @lc code=start
public class Solution {
    public bool IsSubsequence(string s, string t) {
        int i = 0, j = 0;
        while (i < s.Length && j < t.Length)
        {
            if (s[i] == t[j])
            {
                i++;
            }
            j++;
        }
        return i == s.Length;
        /*
        if(s.Length > t.Length) return false;
        int j = 0;
        for(int i = 0; i < s.Length; ++i)
        {
            var c = s[i];
            while(j < t.Length && t[j] != c)
                ++j;
            
            if(j == t.Length)
                return false;
            ++j; 
        }
        return true;
        */
    }
}
// @lc code=end

